# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2Contest do
  @moduledoc """
  Information about a contest that appears on a voter's ballot.

  ## Attributes

  *   `ballotPlacement` (*type:* `String.t`, *default:* `nil`) - A number specifying the position of this contest on the voter's ballot.
  *   `ballotTitle` (*type:* `String.t`, *default:* `nil`) - The official title on the ballot for this contest, only where available.
  *   `candidates` (*type:* `list(GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2Candidate.t)`, *default:* `nil`) - The candidate choices for this contest.
  *   `district` (*type:* `GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2ElectoralDistrict.t`, *default:* `nil`) - Information about the electoral district that this contest is in.
  *   `electorateSpecifications` (*type:* `String.t`, *default:* `nil`) - A description of any additional eligibility requirements for voting in this contest.
  *   `level` (*type:* `list(String.t)`, *default:* `nil`) - The levels of government of the office for this contest. There may be more than one in cases where a jurisdiction effectively acts at two different levels of government; for example, the mayor of the District of Columbia acts at "locality" level, but also effectively at both "administrative-area-2" and "administrative-area-1".
  *   `numberElected` (*type:* `String.t`, *default:* `nil`) - The number of candidates that will be elected to office in this contest.
  *   `numberVotingFor` (*type:* `String.t`, *default:* `nil`) - The number of candidates that a voter may vote for in this contest.
  *   `office` (*type:* `String.t`, *default:* `nil`) - The name of the office for this contest.
  *   `primaryParties` (*type:* `list(String.t)`, *default:* `nil`) - If this is a partisan election, the name of the party/parties it is for.
  *   `referendumBallotResponses` (*type:* `list(String.t)`, *default:* `nil`) - The set of ballot responses for the referendum. A ballot response represents a line on the ballot. Common examples might include "yes" or "no" for referenda. This field is only populated for contests of type 'Referendum'.
  *   `referendumBrief` (*type:* `String.t`, *default:* `nil`) - Specifies a short summary of the referendum that is typically on the ballot below the title but above the text. This field is only populated for contests of type 'Referendum'.
  *   `referendumConStatement` (*type:* `String.t`, *default:* `nil`) - A statement in opposition to the referendum. It does not necessarily appear on the ballot. This field is only populated for contests of type 'Referendum'.
  *   `referendumEffectOfAbstain` (*type:* `String.t`, *default:* `nil`) - Specifies what effect abstaining (not voting) on the proposition will have (i.e. whether abstaining is considered a vote against it). This field is only populated for contests of type 'Referendum'.
  *   `referendumPassageThreshold` (*type:* `String.t`, *default:* `nil`) - The threshold of votes that the referendum needs in order to pass, e.g. "two-thirds". This field is only populated for contests of type 'Referendum'.
  *   `referendumProStatement` (*type:* `String.t`, *default:* `nil`) - A statement in favor of the referendum. It does not necessarily appear on the ballot. This field is only populated for contests of type 'Referendum'.
  *   `referendumSubtitle` (*type:* `String.t`, *default:* `nil`) - A brief description of the referendum. This field is only populated for contests of type 'Referendum'.
  *   `referendumText` (*type:* `String.t`, *default:* `nil`) - The full text of the referendum. This field is only populated for contests of type 'Referendum'.
  *   `referendumTitle` (*type:* `String.t`, *default:* `nil`) - The title of the referendum (e.g. 'Proposition 42'). This field is only populated for contests of type 'Referendum'.
  *   `referendumUrl` (*type:* `String.t`, *default:* `nil`) - A link to the referendum. This field is only populated for contests of type 'Referendum'.
  *   `roles` (*type:* `list(String.t)`, *default:* `nil`) - The roles which this office fulfills.
  *   `sources` (*type:* `list(GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2Source.t)`, *default:* `nil`) - A list of sources for this contest. If multiple sources are listed, the data has been aggregated from those sources.
  *   `special` (*type:* `String.t`, *default:* `nil`) - "Yes" or "No" depending on whether this a contest being held outside the normal election cycle.
  *   `type` (*type:* `String.t`, *default:* `nil`) - The type of contest. Usually this will be 'General', 'Primary', or 'Run-off' for contests with candidates. For referenda this will be 'Referendum'. For Retention contests this will typically be 'Retention'.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :ballotPlacement => String.t() | nil,
          :ballotTitle => String.t() | nil,
          :candidates => list(GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2Candidate.t()) | nil,
          :district => GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2ElectoralDistrict.t() | nil,
          :electorateSpecifications => String.t() | nil,
          :level => list(String.t()) | nil,
          :numberElected => String.t() | nil,
          :numberVotingFor => String.t() | nil,
          :office => String.t() | nil,
          :primaryParties => list(String.t()) | nil,
          :referendumBallotResponses => list(String.t()) | nil,
          :referendumBrief => String.t() | nil,
          :referendumConStatement => String.t() | nil,
          :referendumEffectOfAbstain => String.t() | nil,
          :referendumPassageThreshold => String.t() | nil,
          :referendumProStatement => String.t() | nil,
          :referendumSubtitle => String.t() | nil,
          :referendumText => String.t() | nil,
          :referendumTitle => String.t() | nil,
          :referendumUrl => String.t() | nil,
          :roles => list(String.t()) | nil,
          :sources => list(GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2Source.t()) | nil,
          :special => String.t() | nil,
          :type => String.t() | nil
        }

  field(:ballotPlacement)
  field(:ballotTitle)
  field(:candidates, as: GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2Candidate, type: :list)
  field(:district, as: GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2ElectoralDistrict)
  field(:electorateSpecifications)
  field(:level, type: :list)
  field(:numberElected)
  field(:numberVotingFor)
  field(:office)
  field(:primaryParties, type: :list)
  field(:referendumBallotResponses, type: :list)
  field(:referendumBrief)
  field(:referendumConStatement)
  field(:referendumEffectOfAbstain)
  field(:referendumPassageThreshold)
  field(:referendumProStatement)
  field(:referendumSubtitle)
  field(:referendumText)
  field(:referendumTitle)
  field(:referendumUrl)
  field(:roles, type: :list)
  field(:sources, as: GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2Source, type: :list)
  field(:special)
  field(:type)
end

defimpl Poison.Decoder, for: GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2Contest do
  def decode(value, options) do
    GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2Contest.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.CivicInfo.V2.Model.CivicinfoSchemaV2Contest do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
